home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1988 March & April / rerun-1988-03-04.d64 / bowling 64 (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  3.7 KB  |  124 lines

  1. 0 rem bowling - john fedor
  2. 10 ifpeek(49152)<>76thenfori=0to251:reada:poke49152+i,a:next
  3. 20 poke198,0:clr
  4. 30 dim n$(8),s(26,8),h(8),b(8)
  5. 40 poke53280,0:poke53281,0:sys49155
  6. 50 fori=54272to54296:pokei,0:next:poke54296,15:poke54273,15:poke54277,17
  7. 60 print"[147]bowling by john fedor"
  8. 70 print"how many players (1-8):";
  9. 80 geta$:ifa$<"1"ora$>"8"then80
  10. 90 printa$
  11. 100 np=val(a$)
  12. 110 fori=1tonp
  13. 120 print"[147]player #"i"[157]."
  14. 130 print:print"enter your name ";
  15. 140 inputn$(i)
  16. 150 n$(i)=left$(n$(i)+"                                       ",20)
  17. 160 print"enter handicap (1-10, 1 hardest) ";:inputh(i)
  18. 170 ifh(i)<1orh(i)>10then160
  19. 180 nexti
  20. 190 poke53281,1:print"[147]":poke53281,0
  21. 200 print"players[154] [194] 1[194] 2[194] 3[194] 4[194] 5[194] 6[194] 7[194] 8[194] 9[194] 10[194]"
  22. 210 fori=1tonp
  23. 220 printleft$(n$(i),7)
  24. 230 nexti
  25. 240 forf=1to10:forp=1tonp
  26. 250 print""
  27. 260 fori=1to39:print"[195]";:nexti:print:print:print:print:print:print:print
  28. 270 print:print:print:fori=1to39:print"[195]";:nexti
  29. 280 rem set up pins now ((NULL))
  30. 290 print""
  31. 300 fory=1to7
  32. 310 z=-(y=3ory=5)-2*(y=2ory=6)-3*(y=1ory=7)
  33. 320 printtab(34+z)"[216] ";
  34. 330 ify>2andy<6thenprint"[216]";
  35. 340 print:nexty
  36. 350 b=1:rem which ball #
  37. 360 print"[158]player up:[159]"n$(p)""
  38. 370 gosub380:goto590
  39. 380 y=15:dy=1:poke198,0
  40. 390 b(p)=b(p)+1:d=0
  41. 400 poke828,y:poke829,dy:poke830,10+h(p)*12:sys49152
  42. 410 y=peek(828)
  43. 420 :
  44. 430 forx=1to33:poke1023+y*40+x,32:poke1024+y*40+x,81
  45. 440 fort7=1to2:nextt7,x
  46. 450 x=x-1
  47. 460 x=x+1
  48. 470 a1=1024+y*40+x
  49. 480 ifpeek(a1)=88then510
  50. 490 ifx=39thens(b(p),p)=d:return
  51. 500 pokea1-1,32:pokea1,81:goto460
  52. 510 ifpeek(a1)=88thenpokea1,32:d=d+1:poke54276,0:poke54276,129
  53. 520 ifpeek(a1-39)=88thenpokea1-39,32:d=d+1:poke54276,0:poke54276,129
  54. 530 ifpeek(a1+41)=88thenpokea1+41,32:d=d+1:poke54276,0:poke54276,129
  55. 540 ifpeek(a1+82)=88thenpokea1+82,32:d=d+1:poke54276,0:poke54276,129
  56. 550 ifpeek(a1-78)=88thenpokea1-78,32:d=d+1:poke54276,0:poke54276,129
  57. 560 ifpeek(a1-117)=88thenpokea1-117,32:d=d+1:poke54276,0:poke54276,129
  58. 570 ifpeek(a1+123)=88thenpokea1+123,32:d=d+1:poke54276,0:poke54276,129
  59. 580 goto490
  60. 590 rem ball end of alley
  61. 600 poke1023+x+y*40,32
  62. 610 poke55296+(p+2)*40+5+f*3+b,1
  63. 620 z=1024+(p+2)*40+5+f*3+b:ifd<10thenpokez,48+d
  64. 630 ifb=2andd<10thenpokez,48+d
  65. 640 ifb=1andd=10thenpokez,24
  66. 650 ifb=2andd+s(b(p)-1,p)=10thenpokez,78
  67. 660 ifb=1andd=10thenb(p)=b(p)+1:goto680
  68. 670 ifb=1thenb=2:goto370
  69. 680 iff<10then710
  70. 690 ifb=1thenbu=2:goto720
  71. 700 ifb=2theny=s(b(p),p)+s(b(p)-1,p):ify=10thenbu=1:goto720
  72. 710 nextp,f:goto870:rem scoring
  73. 720 rem bonus ball
  74. 730 print""
  75. 740 if s(19,p)=10 and s(21,p)<10ands(21,p)>0then800
  76. 750 fory=1to7
  77. 760 z=-(y=3ory=5)-2*(y=2ory=6)-3*(y=1ory=7)
  78. 770 printtab(34+z)"[216] ";
  79. 780 ify>2andy<6thenprint"[216]";
  80. 790 print:nexty
  81. 800 d=0:b=b+1:gosub380:bu=bu-1
  82. 810 poke1023+x+y*40,32:poke55296+(p+2)*40+5+f*3+b,1
  83. 820 z=1024+(p+2)*40+5+f*3+b
  84. 830 ifd=10thenpokez,24
  85. 840 ifd<10thenpokez,d+48
  86. 850 ifbuthen720
  87. 860 goto710
  88. 870 rem scoring routine
  89. 880 print""
  90. 890 fori=1to12:print"                                       ":nexti
  91. 900 print""
  92. 910 forp=1tonp:printn$(p)tab(20);
  93. 920 sc=0:b(p)=0:forf=1to9
  94. 930 b(p)=b(p)+1:fb=s(b(p),p)
  95. 940 b(p)=b(p)+1:sb=s(b(p),p)
  96. 950 sc=sc+fb+sb:iffb+sb=10thensc=sc+s(b(p)+1,p)
  97. 960 iffb=10thensc=sc+s(b(p)+2,p):ifs(b(p)+1,p)=10thensc=sc+s(b(p)+3,p)
  98. 970 nextf:b(p)=b(p)+1
  99. 980 b1=s(b(p),p):b2=s(b(p)+1,p):b3=s(b(p)+2,p)
  100. 990 ifb1=10thenb2=b3:b3=s(b(p)+3,p)
  101. 1000 sc=sc+b1+b2+b3
  102. 1010 printsc:nextp
  103. 1020 rem end routine
  104. 1030 print"play again (y/n) ?"
  105. 1040 geta$:ifa$<>"y"anda$<>"n"then1040
  106. 1050 ifa$="y"thenrun
  107. 1060 print"[147]bye":end
  108. 1070 data76,107,192,169,8,32,210,255,173,14,220,41,254,141,14,220
  109. 1080 data165,1,41,251,133,1,162,0,189,0,208,157,0,48,189,0
  110. 1090 data209,157,0,49,189,0,210,157,0,50,189,0,211,157,0,51
  111. 1100 data189,0,212,157,0,52,189,0,213,157,0,53,189,0,214,157
  112. 1110 data0,54,189,0,215,157,0,55,232,208,205,32,234,192,41,240
  113. 1120 data9,12,141,24,208,162,0,189,99,192,157,192,50,232,224,8
  114. 1130 data208,245,96,0,24,24,24,60,126,126,60,169,0,133,251,133
  115. 1140 data252,162,0,24,165,251,109,60,3,133,251,165,252,105,0,133
  116. 1150 data252,232,224,40,208,237,24,165,252,105,4,133,252,160,0,169
  117. 1160 data32,145,251,174,60,3,172,61,3,192,1,208,14,202,56,165
  118. 1170 data251,233,40,133,251,165,252,233,0,133,252,192,2,208,14,232
  119. 1180 data24,165,251,105,40,133,251,165,252,105,0,133,252,142,60,3
  120. 1190 data224,13,240,4,224,21,208,8,173,61,3,73,3,141,61,3
  121. 1200 data169,81,160,0,145,251,174,62,3,160,0,136,208,253,202,208
  122. 1210 data248,32,228,255,208,3,76,141,192,96,165,1,9,4,133,1
  123. 1220 data173,14,220,9,1,141,14,220,173,24,208,96
  124.